aboutsummaryrefslogtreecommitdiff
path: root/web/pw-server/src/routes/bots/[bot_id].svelte
diff options
context:
space:
mode:
Diffstat (limited to 'web/pw-server/src/routes/bots/[bot_id].svelte')
-rw-r--r--web/pw-server/src/routes/bots/[bot_id].svelte34
1 files changed, 34 insertions, 0 deletions
diff --git a/web/pw-server/src/routes/bots/[bot_id].svelte b/web/pw-server/src/routes/bots/[bot_id].svelte
new file mode 100644
index 0000000..90fd78d
--- /dev/null
+++ b/web/pw-server/src/routes/bots/[bot_id].svelte
@@ -0,0 +1,34 @@
+<script lang="ts" context="module">
+ import { get_session_token } from "$lib/auth";
+
+ export async function load({ page }) {
+ const token = get_session_token();
+ const res = await fetch(`/api/bots/${page.params["bot_id"]}`, {
+ headers: {
+ "Content-Type": "application/json",
+ Authorization: `Bearer ${token}`,
+ },
+ });
+
+ if (res.ok) {
+ return {
+ props: {
+ bot: await res.json(),
+ },
+ };
+ }
+
+ return {
+ status: res.status,
+ error: new Error("Could not load bot"),
+ };
+ }
+</script>
+
+<script lang="ts">
+ export let bot: object;
+</script>
+
+<div>
+ {bot["name"]}
+</div>